﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace Skyhook.Core
{
    public class Range
    {
        int Minimum = 0;
        int Maximum = 0;
        int RangeLength = 0;

        public Range(int minimum, int maximum)
        {
            if (minimum > maximum)
            {
                throw new Exception("Range : minimum > maximum");
            }
            Minimum = minimum;
            Maximum = maximum;
            RangeLength = maximum - minimum + 1;
        }

        public int this[int index]
        {
            get
            {
                if (index < RangeLength && index >= 0)
                {
                    return index + Minimum;
                }
                throw new Exception("Range : index out of range");
            }
        }

        public int Count
        {
            get
            {
                return RangeLength;
            }
        }
    }
}
